home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu086.dms / pu086.adf / include / stdio.h < prev    next >
C/C++ Source or Header  |  1990-12-04  |  3KB  |  112 lines

  1. /*
  2.  *
  3.  *    STDIO.H        Standard i/o include file
  4.  *
  5.  */
  6.  
  7. #ifndef STDIO_H
  8. #define    STDIO_H
  9.  
  10. #include <stddef.h>
  11. #include <stdlib.h>
  12. #include <types.h>
  13.  
  14. /*
  15.  *    CONSTANTS:
  16.  */
  17.  
  18. #define    _NFILE        (20)        /* maximum number of open streams */
  19. #define    OPEN_MAX    _NFILE        /* ANSI equivalent (replaces _NFILE) */
  20. #define    FILENAME_MAX    (128)        /* maximum filename size */
  21. #define    BUFSIZ        (1024)        /* default buffer size */
  22. #define    EOF        (-1)        /* end-of-file indicator */
  23. #define    EOS        '\0'        /* end-of-string indicator */
  24.  
  25. #ifndef FALSE
  26. #define    FALSE        (0)        /* boolean false */
  27. #define    TRUE        (!FALSE)    /* boolean true */
  28. #endif
  29.  
  30. #ifndef ERROR
  31. #define    ERROR        (-1)        /* general error condition */
  32. #endif
  33.  
  34. /* lseek() origins */
  35. #define    SEEK_SET    -1        /* from beginning of file */
  36. #define    SEEK_CUR    0        /* from current location */
  37. #define    SEEK_END    1        /* from end of file */
  38.  
  39. /* cfg_ch() control flags */
  40. #define    _CIOB        0x01        /* use bios rather than gemdos */
  41. #define    _CIOCH        0x02        /* return only 8-bit values */
  42. #define    _CIOVT        0x04        /* process vt52 escape codes */
  43.  
  44. /* FILE structure flags */
  45. #define    _IOREAD        0x0001        /* file may be read from */
  46. #define    _IOWRT        0x0002        /* file may be written to */
  47. #define    _IOBIN        0x0004        /* file is in "binary" mode */
  48. #define    _IODEV        0x0008        /* file is a character device */
  49. #define _IOAP        0x0040        /* file opened in append mode */
  50. #define    _IORW        0x0080        /* last i/o was 0:read/1:write */
  51. #define    _IOFBF        0x0100        /* i/o is fully buffered */
  52. #define    _IOLBF        0x0200        /* i/o is line buffered */
  53. #define    _IONBF        0x0400        /* i/o is not buffered */
  54. #define    _IOMYBUF    0x0800        /* standard buffer */
  55. #define    _IOEOF        0x1000        /* EOF has been reached */
  56. #define    _IOERR        0x4000        /* an error has occured */
  57. #define _IOUGET        0x8000        /* Last char was ungeted */
  58.  
  59. typedef    struct            /* FILE structure */
  60.     {
  61.     int        _cnt;        /* # of bytes in buffer */
  62.     int        _pos;        /* Where we have read to */
  63.     unsigned char    *_base;        /* base of file buffer */
  64.     unsigned int    _flag;        /* file status flags */
  65.     APTR        _file;        /* file handle */
  66.     int        _bsiz;        /* buffer size */
  67.     unsigned char    _ch;        /* tiny buffer, for "unbuffered" i/o */
  68.     }
  69.     FILE;
  70.  
  71. #define    L_tmpnam    20
  72. #define    TMP_MAX        1000
  73.  
  74. extern    char    *etext;
  75. extern    char    *edata;
  76. extern    char    *end;
  77.  
  78. extern    void    _exit();
  79.  
  80. extern    FILE    *_iob[];
  81. extern    FILE    *fopen(), *fdopen(), *freopen(), *fopenp();
  82. extern    long    ftell(), fsize();
  83. extern    void    rewind();
  84. extern  int    setbuf(), setvbuf();
  85. extern    char    *fgets(), *gets(), *tmpnam(), *tempnam();
  86. extern    char    *fullpath(), *findfile(), *pfindfile(), *wildcard();
  87.  
  88. /* standard streams */
  89. #define stdin    (_iob[0])
  90. #define stdout    (_iob[1])
  91. #define stderr    (_iob[2])
  92.  
  93. /* stream macros */
  94. #define clearerr(fp)    ((void) ((fp)->_flag &= ~(_IOERR|_IOEOF)))
  95. #define feof(fp)    ((fp)->_flag & _IOEOF)
  96. #define ferror(fp)    ((fp)->_flag & _IOERR)
  97. #define fileno(fp)    ((fp)->_file)
  98.  
  99. /* aliases */
  100. #define    getc            fgetc
  101. #define    ungetc(c,fp)        fungetc((char)(c),fp)
  102. #define    putc            fputc
  103. #define    getchar()        fgetc(stdin)
  104. #define    ungetchar(c)        fungetc((char)(c),stdin)
  105. #define    putchar(c)        fputc((c),stdout)
  106. #define    fexists            exists
  107. #define    exists(f)        access(f,0x00)
  108. #define    unlink            remove
  109. #define puts(str)        fputs(str,stdout)
  110.  
  111. #endif STDIO_H
  112.